#include <ClassData.h>


ClassData::ClassData(QObject *parent) : QObject(parent)
{

}

ClassData::~ClassData()
{

}

void ClassData::setObject( QObject* object_ptr )
{
	m_object = object_ptr;
}

void ClassData::setVariantProperty( QtVariantProperty* property_ptr )
{
	m_property = property_ptr;
}

QtVariantProperty* ClassData::getVariantProperty()
{
	return m_property;
}

void ClassData::setClassTypeName( const QString& classTypeName )
{
	m_classTypeName = classTypeName;
}

QString ClassData::getClassTypeName()
{
	return m_classTypeName;
}
void ClassData::fillPropertyValue(QSharedPointer<QObject> object_ptr)
{
    QList<QtProperty*> sub_property_list = m_property->subProperties();
    for(int i=0; i<sub_property_list.size(); i++)
    {
        QString property_name = sub_property_list.at(i)->propertyName();//属性名
        QVariant value = object_ptr->property(property_name.toStdString().c_str());
        QtVariantProperty* variant_property = dynamic_cast<QtVariantProperty*>(sub_property_list.at(i));
        if(variant_property != NULL)
        {
            variant_property->setValue(value);
        }

    }
}
bool ClassData::checkProperty(QtProperty * property)
{
    QList<QtProperty*> sub_property_list = m_property->subProperties();
    for(int i=0; i<sub_property_list.size(); i++)
    {
        if(property == sub_property_list.at(i))
        {
            return true;
        }
    }
    return false;
}

bool ClassData::getShowInClassList()
{
    return m_showInClassList;
}

void ClassData::setShowInClassList(bool boolValue)
{
    m_showInClassList = boolValue;
}
